home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazine 28 Bonus / CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin / data / artmain.dir / 00096_Script_QTVR Win Scripts < prev    next >
Text File  |  1996-06-05  |  22KB  |  582 lines

  1.  
  2. -- ⌐ 1992-1995 Apple Computer, Inc.  All rights reserved.
  3.  
  4. --========================================================================
  5. -- Routines for initializing and cleaning up the Director movie.
  6. --------------------------------------------------------------------------
  7.  
  8.  
  9. --====================================================================
  10. -- StartMovie
  11. --
  12. -- Runs at movie start time.  Initializes key globals and opens the
  13. -- external library.
  14. ----------------------------------------------------------------------
  15. on InitQTVRWin
  16.   global gPathName, gLastTimeRollover, gPanoFrame
  17.   put empty into gPathName
  18.   put false into gLastTimeRollover
  19.   put empty into gPanoFrame
  20.   
  21.   -- Open the DLL which contains the QTVRW XObject
  22.   
  23.   openxlib the pathname & "ARTMAINA\QTVRW.QTC"
  24.   
  25.   -- Ensure that QuickTime is initialized by opening and
  26.   -- closing a QTVRW object.  This is only necessary to deal
  27.   -- with some harmless problems that Dr. Watson will detect
  28.   -- if a QuickTime movie is not opened before you close
  29.   -- the QTVRW.QTC xlibrary and exit the projector.  (Note
  30.   -- that these problems do not occur in Director itself.)  If
  31.   -- you can guarantee to open a QuickTime movie before exiting,
  32.   -- these lines are not necessary.
  33.   
  34.   set tInitObj = QTVRW (mNew, "Nav")
  35.   if objectP (tInitObj) then tInitObj (mDispose)
  36.   
  37.   -- Create callback factories for panoramas
  38.   global gPanoCallbackFactory, gTestCallbackFactory
  39.   put SampleCallbacksWin(mNew) into gPanoCallbackFactory
  40.   -- put TestCallbacksWin(mNew) into gTestCallbackFactory
  41.   
  42. end InitQTVRWin
  43.  
  44. --====================================================================
  45. -- StopMovie
  46. --
  47. -- Runs at movie stop time.  Closes any open pano or nav movies.
  48. -- Closes the external code library.
  49. ----------------------------------------------------------------------
  50. on disposeQTVRWin
  51.   -- Close any open panoramic or object movies
  52.   ClosePanoMovieWin
  53.   CloseNavMovieWin
  54.   
  55.   -- Close the DLL
  56.   closexlib the pathname & "ARTMAINA\QTVRW.QTC"
  57.   
  58.   global gPanoCallbackFactory, gTestCallbackFactory
  59.   if objectP(gPanoCallbackFactory) then gPanoCallbackFactory(mDispose)
  60.   -- if objectP(gTestCallbackFactory) then gTestCallbackFactory(mDispose)
  61.   
  62. end disposeQTVRWin
  63.  
  64.  
  65. --========================================================================
  66. -- Routines for managing navigable movies
  67. --------------------------------------------------------------------------
  68.  
  69.  
  70. --========================================================================
  71. -- OpenNavMovie:
  72. --      pFilename is the full file path of the file
  73. --      pSpriteNum is the sprite associated with the direct Nav Movie
  74. --      pShowOnOpen is a boolean for showing the movie on screen immediately
  75. --
  76. -- Opens the file pFileName as a nav movie at the top left corner of sprite
  77. -- pSpriteNum.  Shows it on the screen as dictated by pShowOnOpen.
  78. --------------------------------------------------------------------------
  79. on OpenNavMovie pFilename, pSpriteNum, pShowOnOpen
  80.   global gNavMovieObj
  81.   
  82.   -- These routines are structured similarly to the Macintosh-based routines,
  83.   -- and the use of a single global gNavMovieObj to hold the instance reference
  84.   -- restricts usage by allowing only one navigable movie to be open at a time.
  85.   
  86.   -- Close any other open nav movie.
  87.   CloseNavMovieWin
  88.   
  89.   -- Load in the movie.  Assume the underlying sprite is the correct size.
  90.   set gNavMovieObj = QTVRW (mNew, "Nav")
  91.   if not objectP(gNavMovieObj) then
  92.     put "Unable to create new Nav instance"
  93.     beep
  94.     exit
  95.   end if
  96.   
  97.   put gNavMovieObj (mOpenMovie, pFileName, the left of sprite pSpriteNum ¼
  98.       & "," & the top of sprite pSpriteNum) into tResultCode
  99.   if tResultCode = 0 then
  100.     put "Unable to open navmovie"
  101.     gNavMovieObj (mDispose)
  102.     beep
  103.     exit
  104.   end if
  105.   
  106.   if pShowOnOpen then
  107.     -- Show the poster frame of the nav movie on screen
  108.     gNavMovieObj (mUpdate)
  109.   end if
  110. end OpenNavMovie
  111.  
  112.  
  113. --========================================================================
  114. -- ShowNavMovie
  115. --
  116. -- Updates the nav movie display on screen.
  117. --------------------------------------------------------------------------
  118. on ShowNavMovie
  119.   global gNavMovieObj
  120.   if objectP (gNavMovieObj)  then
  121.     gNavMovieObj (mUpdate)
  122.   end if
  123. end ShowNavMovie
  124.  
  125.  
  126. --========================================================================
  127. -- SetNavMovieView:
  128. --      pHPan is the horizontal pan angle
  129. --      pVPan is the vertical pan angle
  130. --
  131. -- Sets the nav movie view to the specified pan angles.
  132. --------------------------------------------------------------------------
  133. on SetNavMovieView pHPan, pVPan
  134.   global gNavMovieObj
  135.   if objectP (gNavMovieObj) then
  136.     gNavMovieObj (mSetHPanAngle, string(pHPan))
  137.     gNavMovieObj (mSetVPanAngle, string(pVPan))
  138.   end if
  139. end SetNavMovieView
  140.  
  141.  
  142. --========================================================================
  143. -- CloseNavMovieWin
  144. --
  145. -- Disposes an open nav movie.  This does not remove the image from
  146. -- the screen.
  147. --------------------------------------------------------------------------
  148. on CloseNavMovieWin
  149.   global gNavMovieObj
  150.   if objectP (gNavMovieObj) then
  151.     gNavMovieObj (mDispose)
  152.   end if 
  153. end CloseNavMovieWin
  154.  
  155.  
  156. --========================================================================
  157. -- NavFrameScript
  158. --      pSpriteNum is the sprite which lies under the nav movie
  159. --
  160. -- When run frequently, provides cursor feedback over the nav movie
  161. -- and handles mouse down and keyboard actions.
  162. --------------------------------------------------------------------------
  163. on NavFrameScript pSpriteNum
  164.   global gNavMovieObj
  165.   if objectP (gNavMovieObj) then 
  166.     if rollover (pSpriteNum) then
  167.       gNavMovieObj (mMouseOver)
  168.       cursor 200
  169.       cursor -1
  170.     else
  171.       gNavMovieObj(mIdle)
  172.     end if
  173.   end if
  174. end NavFrameScript
  175.  
  176.  
  177. --========================================================================
  178. -- Routines for managing panoramic movies
  179. --------------------------------------------------------------------------
  180.  
  181.  
  182. --========================================================================
  183. -- OpenPanoMovieWin
  184. --      pFilename is the full file path of the file
  185. --      pSpriteNum is the sprite associated with the direct Pano Movie
  186. --      pShowOnOpen is a boolean for showing the movie on screen immediately
  187. --
  188. -- Opens the file pFileName as a panoramic movie, and sets up callback
  189. -- handlers as specified.  Updates the screen with the movie's default
  190. -- view if requested by pShowOnOpen
  191. --------------------------------------------------------------------------
  192. on OpenPanoMovieWin pFileName, pSpriteNum, pShowOnOpen
  193.   global gPanoMovieObj, gPathName
  194.   
  195.   -- These routines are structured similarly to the Macintosh-based routines,
  196.   -- and the use of a single global gPanoMovieObj to hold the instance reference
  197.   -- restricts usage by allowing only one navigable movie to be open at a time.
  198.   
  199.   -- Close any other open pano movie.
  200.   ClosePanoMovieWin
  201.   
  202.   set gPanoMovieObj = QTVRW (mNew, "Pan")
  203.   if not objectP(gPanoMovieObj) then
  204.     put "Unable to create new Pan instance"
  205.     beep
  206.     exit
  207.   end if
  208.   
  209.   -- Load in the movie.  Assume the underlying sprite is the correct size.
  210.   put gPanoMovieObj (mOpenMovie, pFileName, the left of sprite pSpriteNum ¼
  211.       & "," & the top of sprite pSpriteNum) into tResultCode
  212.   if tResultCode = 0 then
  213.     put "Unable to open panomovie"
  214.     gPanoMovieObj (mDispose)
  215.     beep
  216.     exit
  217.   end if
  218.   
  219.   put ExtractPathNameWin(pFileName) into gPathName
  220.   
  221.   InitPanoCallbacksWin
  222.   
  223.   if pShowOnOpen then
  224.     gPanoMovieObj (mUpdate)
  225.   end if
  226.   
  227. end OpenPanoMovieWin
  228.  
  229.  
  230. --========================================================================
  231. -- InitPanoCallbacksWin
  232. --
  233. -- Initializes the callbacks used for panoramic movies.
  234. --------------------------------------------------------------------------
  235. on InitPanoCallbacksWin
  236.   global gPanoMovieObj, gPanoCallbackFactory
  237.   if objectP(gPanoMovieObj) and objectP(gPanoCallbackFactory) then
  238.     -